import React, { useMemo } from "react";
import { Divider } from "antd";

const ChildCom = (props: any): React.ReactElement => {
  function atr(props: any) {
    console.log(props);
    return props.name;
  }
  const abbb = useMemo(() => atr(props), [props.name]);
  //   const [state, setstate] = useState(props);
  return (
    <div>
      <div>{abbb}</div>
      {/* <div>{props.name}</div> */}
      {/* <div>
        <Button
          type="default"
          onClick={() => setstate({ name: new Date().getMonth() })}
        >
          变化
        </Button>
      </div> */}
      <Divider orientation="left">
        Do it 不过useMemo还挺扰人的，终于弄懂了，
      </Divider>
      <Divider orientation="left">
        end
        传值的时候传了多个值，子组件监听应该精准监听到.name值，此时才会生效！淦
      </Divider>
    </div>
  );
};

export default ChildCom;
